package createThread.cn.tedu.threaddemo.test9;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Demo4 {
    public static void main(String[] args) {
        Runnable task1 = ()->{
            System.out.println("task1");
        };
        Runnable task2 = ()->{
            System.out.println("task2");
        };
        Runnable task3 = ()->{
            System.out.println("task3");
        };
        Runnable task4 = ()->{
            System.out.println("task4");
        };

        ExecutorService executorService = Executors.newCachedThreadPool();
        executorService.execute(task1);
        executorService.execute(task2);
        executorService.execute(task3);
        executorService.execute(task4);

        executorService.shutdown();
    }
}
